#include <Arduino.h>
#include "SimpleTask.h"

void ledTask();
void displayTask();

// Create task scheduler
SimpleTask task;

void setup()
{
    Serial.begin(115200);
    pinMode(LED_BUILTIN, OUTPUT);

    // Create tasks
    task.createTask(ledTask, 500);
    task.createTask(displayTask, 1000);
}

void loop()
{
    // Execute task scheduler
    task.taskScheduler();
    delay(1);
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////

/**
 * @brief Toggle the LED
 */
void ledTask()
{
    digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
}

/**
 * @brief Dummy display task.
 */
void displayTask()
{
    static int counter = 0;
    counter++;

    Serial.print("current count: ");
    Serial.println(counter);
}